from .base import Handler
from event_engine.event import Event
from event_engine.engine import EventEngine
from event_engine.event_type import *
from models.ip_pool import IpPool, IP


class ProxyIpHandler(Handler):
    """
    获取代理ip
    """

    def process(self, event: Event, engine: EventEngine) -> None:
        ip: IP = IpPool.get()
        event.data["ip"] = ip
        engine.put(Event(EVENT_DOWNLOAD, event.data))
